export let playlist_cat = {
  namespaced: true,
  state: {
    playlist_cat_data: {},
  },
  actions: {
    getPlaylistCatData(store, data = {}) {
      let url = "/top/playlist?limit=" + data.limit + "&order=" + data.order + "&cat=" + data.cat + "&offset=" + (data.offset - 1) * data.limit;
      return new Promise((resolve, reject) => {
        axios.get(url).then(({
          data
        }) => {
          store.commit("setPlaylistCatData", data);
          resolve(data);
        }).catch((error) => {
          if (error.response) {
            // 请求已发出，但服务器响应的状态码不在 2xx 范围内
            reject(error.response.data)
          }
        });
      })
    },
  },
  mutations: {
    setPlaylistCatData(state, data) {
      state.playlist_cat_data = data;
    },
  }
}
